package com.medical.data.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.medical.data.domain.UserProject;
import com.medical.data.exception.MyException;
import com.medical.data.mapper.UserProjectMapper;
import com.medical.data.service.UserProjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.medical.data.utils.ResultCode;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cj
 * @since 2024-02-07
 */
@Service
public class UserProjectServiceImpl extends ServiceImpl<UserProjectMapper, UserProject> implements UserProjectService {

    @Override
    public void deleteProjectById(String projectId) {
        int delete = baseMapper.delete(Wrappers.<UserProject>lambdaQuery().eq(UserProject::getProjectId, projectId));
        if (delete < 1) {
            throw new MyException(ResultCode.ERROR.getCode(), "删除用户患者表失败");
        }
    }
}
